<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta >
    <title th:text="${'印刷ERP管理系统'}"></title>
    <link rel="shortcut icon" th:href="@{/static/images/favicon.ico}" />
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link th:href="@{/static/css/login/login.css}" rel="stylesheet">
    <script th:src="@{/static/jQuery/jquery.min.js}"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var username = $("#username").val();
            if(username.length > 0)
                $("#password").focus();
            else
                $("#username").focus();
        });
        // 按键监听方法
        function onKey(e) {
            var keyNum;
            keyNum = window.event ? e.keyCode : e.which;
            if (keyNum == 13) {
                doLogin();
            }
        }
        function doLogin() {
            var username = $("#username").val();
            var password = $("#password").val();
            if(username.length == 0 || password.length == 0) {
                alert("用户名和者密码必填");
                return;
            }
            document.getElementById("theForm").submit();
        }

    </script>
</head>
<body onkeypress="return onKey(event)">
<!--面板-->
<div id="panel">
    <!--面板的头部-->
    <div class="panel-top">
        <h2 th:text="${'印刷ERP管理系统'}"></h2>
    </div>
    <form id="theForm" th:action="@{/login}" method="post" th:object="${user}">
        <!--面板的主要内容-->
        <div class="panel-content">
            <div class="int">
                <label><img th:src="@{/static/images/user.png}" width="20px" height="20px"></label>
                <input type="text" name="username" id="username" th:value="${username}" placeholder="你的手机号/用户名" />
            </div>
            <div class="int">
                <label><img th:src="@{/static/images/passwd.png}" width="20px" height="20px"></label>
                <input type="password" name="password" id="password" placeholder="输入密码" />
            </div>
            <div class="login">
                <button type="button" onclick="doLogin()">登录</button>
            </div>
            <div class="reg">
                <span style="font-weight: 500;color: orangered" th:text="${errorMsg}"></span>
            </div>
        </div>
    </form>
</div>
</body>
</html>